# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=phpsploit
pkgver=1021.aea961d
pkgrel=5
pkgdesc='Stealth post-exploitation framework.'
groups=('blackarch' 'blackarch-webapp')
arch=('any')
url='https://github.com/nil0x42/phpsploit'
license=('GPL3')
depends=('python' 'python-colorama' 'python-pygments' 'python-tornado'
         'python-termcolor' 'python-pyparsing' 'python-phpserialize')
makedepends=('git')
source=("git+https://github.com/nil0x42/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md CHANGELOG.md \
    CONTRIBUTE DISCLAIMER INSTALL.md TODO
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm *.md CONTRIBUTE DISCLAIMER LICENSE TODO

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

